.class public Lcom/opongo/blogapp/activities/ShoutBoxActivity;
.super Landroid/app/Activity;
.source "ShoutBoxActivity.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/opongo/blogapp/activities/ShoutBoxActivity$downloadShoutboxAsyncTask;
    }
.end annotation


# static fields
#the value of this static final field might be set in the static constructor
.field public static final DEBUG:Z = false

.field public static final PREFS_NAME:Ljava/lang/String; = "BlogApp"

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private context:Landroid/content/Context;

.field private currentURL:Ljava/lang/String;

.field private postContentView:Landroid/webkit/WebView;

.field private refreshBox:Z

.field private settings:Landroid/content/SharedPreferences;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 33
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->DEBUG:Z

    .line 34
    const-class v0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->TAG:Ljava/lang/String;

    .line 31
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 31
    invoke-direct {p0}, Landroid/app/Activity;-><init>()V

    return-void
.end method

.method static synthetic access$0()Ljava/lang/String;
    .locals 1

    .prologue
    .line 34
    sget-object v0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$1(Lcom/opongo/blogapp/activities/ShoutBoxActivity;)Landroid/content/Context;
    .locals 1
    .parameter

    .prologue
    .line 40
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->context:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$2(Lcom/opongo/blogapp/activities/ShoutBoxActivity;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 37
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->currentURL:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$3(Lcom/opongo/blogapp/activities/ShoutBoxActivity;)Landroid/webkit/WebView;
    .locals 1
    .parameter

    .prologue
    .line 35
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    return-object v0
.end method

.method static synthetic access$4(Lcom/opongo/blogapp/activities/ShoutBoxActivity;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 36
    iput-boolean p1, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->refreshBox:Z

    return-void
.end method

.method static synthetic access$5(Lcom/opongo/blogapp/activities/ShoutBoxActivity;)Landroid/content/SharedPreferences;
    .locals 1
    .parameter

    .prologue
    .line 38
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->settings:Landroid/content/SharedPreferences;

    return-object v0
.end method

.method private loadShoutbox(Ljava/lang/String;)V
    .locals 4
    .parameter "urlString"

    .prologue
    const/4 v3, 0x1

    .line 252
    iput-boolean v3, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->refreshBox:Z

    .line 254
    new-instance v0, Landroid/content/Intent;

    const-string v1, "com.opongo.progressDialog_show"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 255
    .local v0, i:Landroid/content/Intent;
    const-string v1, "MESSAGE"

    const v2, 0x7f070017

    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 256
    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->sendBroadcast(Landroid/content/Intent;)V

    .line 258
    new-instance v1, Lcom/opongo/blogapp/activities/ShoutBoxActivity$downloadShoutboxAsyncTask;

    const/4 v2, 0x0

    invoke-direct {v1, p0, v2}, Lcom/opongo/blogapp/activities/ShoutBoxActivity$downloadShoutboxAsyncTask;-><init>(Lcom/opongo/blogapp/activities/ShoutBoxActivity;Lcom/opongo/blogapp/activities/ShoutBoxActivity$downloadShoutboxAsyncTask;)V

    new-array v2, v3, [Ljava/lang/String;

    const/4 v3, 0x0

    aput-object p1, v2, v3

    invoke-virtual {v1, v2}, Lcom/opongo/blogapp/activities/ShoutBoxActivity$downloadShoutboxAsyncTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 259
    return-void
.end method

.method private replaceStyle(Ljava/lang/String;)Ljava/lang/String;
    .locals 9
    .parameter "htmlString"

    .prologue
    .line 137
    const/4 v0, 0x0

    .line 139
    .local v0, cssString:Ljava/lang/String;
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v6

    const/high16 v7, 0x7f05

    invoke-virtual {v6, v7}, Landroid/content/res/Resources;->openRawResource(I)Ljava/io/InputStream;

    move-result-object v2

    .line 140
    .local v2, instream:Ljava/io/InputStream;
    new-instance v4, Ljava/io/BufferedReader;

    new-instance v6, Ljava/io/InputStreamReader;

    .line 141
    invoke-direct {v6, v2}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    .line 140
    invoke-direct {v4, v6}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    .line 143
    .local v4, reader:Ljava/io/BufferedReader;
    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    .line 145
    .local v5, sb:Ljava/lang/StringBuilder;
    const/4 v3, 0x0

    .line 147
    .local v3, line:Ljava/lang/String;
    :goto_0
    :try_start_0
    invoke-virtual {v4}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v3

    if-nez v3, :cond_0

    .line 154
    :goto_1
    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 156
    const-string v6, "<link.*?href=\".*?\".*?>"

    .line 157
    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "<style type=\"text/css\">"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, "</style>"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    .line 156
    invoke-virtual {p1, v6, v7}, Ljava/lang/String;->replaceFirst(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    .line 158
    const-string v6, "<link.*?href=\".*?\".*?>"

    const-string v7, ""

    invoke-virtual {p1, v6, v7}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    .line 160
    return-object p1

    .line 148
    :cond_0
    :try_start_1
    new-instance v6, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v7

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v7, "\n"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    .line 149
    :catch_0
    move-exception v1

    .line 151
    .local v1, e:Ljava/io/IOException;
    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_1
.end method


# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
    .locals 12
    .parameter "savedInstanceState"

    .prologue
    const/4 v3, 0x0

    .line 45
    sget-boolean v0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->DEBUG:Z

    if-eqz v0, :cond_0

    .line 46
    sget-object v0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->TAG:Ljava/lang/String;

    const-string v1, "*** create ***"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 48
    :cond_0
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 50
    iput-object p0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->context:Landroid/content/Context;

    .line 52
    const v0, 0x7f030015

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->setContentView(I)V

    .line 54
    const-string v0, "http://www.mein-deal.com"

    iput-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->currentURL:Ljava/lang/String;

    .line 56
    const-string v0, "BlogApp"

    invoke-virtual {p0, v0, v3}, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->settings:Landroid/content/SharedPreferences;

    .line 58
    new-instance v9, Lcom/opongo/blogapp/activities/ShoutBoxActivity$1;

    invoke-direct {v9, p0}, Lcom/opongo/blogapp/activities/ShoutBoxActivity$1;-><init>(Lcom/opongo/blogapp/activities/ShoutBoxActivity;)V

    .line 101
    .local v9, mWebClient:Landroid/webkit/WebViewClient;
    const v0, 0x7f08002d

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/webkit/WebView;

    iput-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    .line 104
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    invoke-virtual {v0, v9}, Landroid/webkit/WebView;->setWebViewClient(Landroid/webkit/WebViewClient;)V

    .line 107
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    invoke-virtual {v0}, Landroid/webkit/WebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v0

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/webkit/WebSettings;->setJavaScriptEnabled(Z)V

    .line 109
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    invoke-virtual {v0}, Landroid/webkit/WebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v0

    invoke-virtual {v0, v3}, Landroid/webkit/WebSettings;->setBuiltInZoomControls(Z)V

    .line 111
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    invoke-virtual {v0, v3}, Landroid/webkit/WebView;->setScrollBarStyle(I)V

    .line 113
    const/4 v2, 0x0

    .line 115
    .local v2, htmlString:Ljava/lang/String;
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const v1, 0x7f050001

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->openRawResource(I)Ljava/io/InputStream;

    move-result-object v7

    .line 116
    .local v7, instream:Ljava/io/InputStream;
    new-instance v10, Ljava/io/BufferedReader;

    new-instance v0, Ljava/io/InputStreamReader;

    .line 117
    invoke-direct {v0, v7}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    .line 116
    invoke-direct {v10, v0}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    .line 119
    .local v10, reader:Ljava/io/BufferedReader;
    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    .line 121
    .local v11, sb:Ljava/lang/StringBuilder;
    const/4 v8, 0x0

    .line 123
    .local v8, line:Ljava/lang/String;
    :goto_0
    :try_start_0
    invoke-virtual {v10}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v8

    if-nez v8, :cond_1

    .line 130
    :goto_1
    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 132
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    const-string v1, "http://www.mein-deal.com"

    .line 133
    const-string v3, "text/html"

    const-string v4, "UTF-8"

    const/4 v5, 0x0

    .line 132
    invoke-virtual/range {v0 .. v5}, Landroid/webkit/WebView;->loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 134
    return-void

    .line 124
    :cond_1
    :try_start_1
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-static {v8}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "\n"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v11, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    .line 125
    :catch_0
    move-exception v6

    .line 127
    .local v6, e:Ljava/io/IOException;
    invoke-virtual {v6}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_1
.end method

.method public onPause()V
    .locals 6

    .prologue
    .line 298
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    if-eqz v0, :cond_0

    .line 299
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    const-string v1, "http://www.mein-deal.com"

    const-string v2, ""

    .line 300
    const-string v3, "text/html"

    const-string v4, "UTF-8"

    const/4 v5, 0x0

    .line 299
    invoke-virtual/range {v0 .. v5}, Landroid/webkit/WebView;->loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 302
    :cond_0
    invoke-super {p0}, Landroid/app/Activity;->onPause()V

    .line 303
    return-void
.end method

.method public onResume()V
    .locals 11

    .prologue
    .line 263
    sget-boolean v0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->DEBUG:Z

    if-eqz v0, :cond_0

    .line 264
    sget-object v0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->TAG:Ljava/lang/String;

    const-string v1, "onResume"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 266
    :cond_0
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    if-eqz v0, :cond_1

    iget-boolean v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->refreshBox:Z

    if-nez v0, :cond_1

    .line 270
    const/4 v2, 0x0

    .line 272
    .local v2, htmlString:Ljava/lang/String;
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const v1, 0x7f050001

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->openRawResource(I)Ljava/io/InputStream;

    move-result-object v7

    .line 273
    .local v7, instream:Ljava/io/InputStream;
    new-instance v9, Ljava/io/BufferedReader;

    new-instance v0, Ljava/io/InputStreamReader;

    .line 274
    invoke-direct {v0, v7}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    .line 273
    invoke-direct {v9, v0}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    .line 276
    .local v9, reader:Ljava/io/BufferedReader;
    new-instance v10, Ljava/lang/StringBuilder;

    invoke-direct {v10}, Ljava/lang/StringBuilder;-><init>()V

    .line 278
    .local v10, sb:Ljava/lang/StringBuilder;
    const/4 v8, 0x0

    .line 280
    .local v8, line:Ljava/lang/String;
    :goto_0
    :try_start_0
    invoke-virtual {v9}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v8

    if-nez v8, :cond_2

    .line 287
    :goto_1
    invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 289
    iget-object v0, p0, Lcom/opongo/blogapp/activities/ShoutBoxActivity;->postContentView:Landroid/webkit/WebView;

    const-string v1, "http://www.mein-deal.com"

    .line 290
    const-string v3, "text/html"

    const-string v4, "UTF-8"

    const/4 v5, 0x0

    .line 289
    invoke-virtual/range {v0 .. v5}, Landroid/webkit/WebView;->loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 293
    .end local v2           #htmlString:Ljava/lang/String;
    .end local v7           #instream:Ljava/io/InputStream;
    .end local v8           #line:Ljava/lang/String;
    .end local v9           #reader:Ljava/io/BufferedReader;
    .end local v10           #sb:Ljava/lang/StringBuilder;
    :cond_1
    invoke-super {p0}, Landroid/app/Activity;->onResume()V

    .line 294
    return-void

    .line 281
    .restart local v2       #htmlString:Ljava/lang/String;
    .restart local v7       #instream:Ljava/io/InputStream;
    .restart local v8       #line:Ljava/lang/String;
    .restart local v9       #reader:Ljava/io/BufferedReader;
    .restart local v10       #sb:Ljava/lang/StringBuilder;
    :cond_2
    :try_start_1
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-static {v8}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "\n"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v10, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    .line 282
    :catch_0
    move-exception v6

    .line 284
    .local v6, e:Ljava/io/IOException;
    invoke-virtual {v6}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_1
.end method
